package kr.co.probrain.timetable;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kr.co.probrain.member.MemberDAO;
import kr.co.probrain.member.MemberVO;

/**
 * Servlet implementation class Timetable
 */
@WebServlet("/Timetable")
public class Timetable extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Timetable() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("EUC-KR");
		TimetableDAO timetableDAO = new TimetableDAO();
		ArrayList<MemberVO> arrayList = timetableDAO.getMemberList( );
		
		if( arrayList.size() == 0 ) {
			request.setAttribute("result", null);
		} else {
			request.setAttribute("result", arrayList);
		}
		
		
		RequestDispatcher view = request.getRequestDispatcher("timetable.jsp");
		view.forward(request, response);
	}
}
